package javagame;

import org.newdawn.slick.*;
import org.newdawn.slick.state.*;

public class Menu extends BasicGameState {
	
	private Image slika;
	private Image logo;
	private int slikaX;
	private int slikaY;
	
	private int mouseX, mouseY;
	
	public Menu (int state) {
	}

	public int getID() {
		return 0;
	}

	public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
		slikaX = 0;
		slikaY = 0;
		slika = new Image("res/meni2.png");
		logo = new Image("res/logo_mali.png");
		//Nivo.setNivo(1);
	}

	public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
		g.drawImage(slika, slikaX, slikaY);
		g.drawImage(logo, 890, 600);
		//g.drawString("mouseX: " + mouseX + "\nmouseY: " + mouseY, 400, 60);
	}
	
	public void fullScreenOnOff (GameContainer gc) throws SlickException {
		if (gc.getInput().isKeyDown(Input.KEY_F)) {
			if (gc.isFullscreen()) {
				gc.setFullscreen(false);
			}
			else {
				gc.setFullscreen(true);
			}
		}
	}

	public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
		Input input = gc.getInput();
		mouseX = input.getMouseX();
	  	mouseY = input.getMouseY();
		
	  	fullScreenOnOff(gc);
		//start
		if ((mouseX>312 && mouseX<712) && (mouseY>253 && mouseY<352)) {
			if (input.isMousePressed(0)) {
				//sbg.enterState(Nivo.getNivo());
				sbg.enterState(1);
			}
		}
		
		//options
		if ((mouseX>312 && mouseX<712) && (mouseY>368 && mouseY<467)) {
			if (input.isMousePressed(0)) {
				sbg.enterState(2);
			}
		}
		
		//controls
		if ((mouseX>312 && mouseX<712) && (mouseY>483 && mouseY<582)) {
			if (input.isMousePressed(0)) {
				sbg.enterState(3);
			}
		}
		//exit
		if ((mouseX>312 && mouseX<712) && (mouseY>599 && mouseY<698)) {
			if (input.isMousePressed(0)) {
				gc.exit();
			}
		}
	}
	
}
